<fieldset>
	<?php echo $this->Form->create('Delivery'); ?>
	<div class="deliveries index">
		<h2><?php echo __('Receive Orders'); ?> from <?php echo $suppliers['Suppliers']['supplierName']; ?></h2>
		<table id="data" class="table" cellpadding="0" cellspacing="0">
		<tr>
				<th>Brand</th>
				<th>Range</th>
				<th>Category</th>
				<th>Description</th>
				<th>Size</th>
				<th>Order Quantity</th>
				<th>Delivered Quantity</th>
				<th>Receive Quantity</th>
		</tr>
		<?php $a = 0;?>
		<?php foreach ($ordersproducts as $product => $i): ?>
		<tr>
			<?php echo $this->Form->hidden($a, array('value' => $i['Ordersproducts']['id'])); ?>
			<td><?php 	echo $i['Brands']['name'];?></td>
			<td><?php 	echo $i['Ranges']['name'];?></td>
			<td><?php 	echo $i['Categories']['name'];?></td>
			<td><?php 	echo $i['Products']['description'];?></td>
			<td><?php 	echo $i['Products']['size'];?></td>
			<td><?php 	echo $i['Ordersproducts']['orderQty'];?> </td>
			<td><?php 	echo $i['Ordersproducts']['deliveredQty'];?> </td>
			<td>
				<?php   $num = $i['Ordersproducts']['orderQty'] - $i['Ordersproducts']['deliveredQty'];
				if($num == 0){
					echo 'Completed';
				}
				else {
					echo $this->Form->input('Receive Quantity.'.$a, array('value' => $num,'label' => '', 'type' => 'number', 'step' => 'any'));
				}?>
			</td>
		</tr>
		<?php $a++;?>
	<?php endforeach; ?>
		</table>
	</div>
	<div class="newsubmit">
	<?php echo $this->Form->submit(__('Receive Order', true), array('formnovalidate' => true, 'div' => false, 'class' => 'btn btn-success')); ?>
	<ul><li><?php echo $this->Html->link(__('Back'), array('action' => 'chooseorder')); ?></li></ul></div>
</fieldset>